
<%@ page import="com.surelution.projects.crm.CompetitorStation" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'competitorStation.label', default: 'CompetitorStation')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
        </div>
        <div class="body">
            <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                            <g:sortableColumn property="name" title="${message(code: 'competitorStation.name.label', default: 'Name')}" />

                            <g:sortableColumn property="address" title="${message(code: 'competitorStation.address.label', default: 'Address')}" />
                        
                            <g:sortableColumn property="company" title="${message(code: 'competitorStation.company.label', default: 'company')}" />

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.station.label"/></th>

                            <g:sortableColumn property="company" title="${message(code: 'competitorStation.manager.label', default: 'manager')}" />

                            <g:sortableColumn property="company" title="${message(code: 'competitorStation.managerTel.label', default: 'managerTel')}" />

							<g:sortableColumn property="isLocked" title="${message(code: 'market.isLocked.label', default: 'isLocked')}" />

                            <g:sortableColumn property="isLocked" title="${message(code: 'market.operation.label', default: 'operation')}" />
							

                    </thead>
                    <tbody>
                    <g:each in="${competitorStationInstanceList}" status="i" var="competitorStationInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            <td><g:link action="show" id="${competitorStationInstance.id}">${fieldValue(bean: competitorStationInstance, field: "name")}</g:link></td>
                        
                            <td>${fieldValue(bean: competitorStationInstance, field: "address")}</td>
                        
                            <td>${fieldValue(bean: competitorStationInstance, field: "company.name")}</td>
                            
                            <td>${fieldValue(bean: competitorStationInstance, field: "station.shortName")}</td>

                            <td>${fieldValue(bean: competitorStationInstance, field: "manager")}</td>

                            <td>${fieldValue(bean: competitorStationInstance, field: "managerTel")}</td>

                            <td><g:formatBoolean boolean="${competitorStationInstance.isLocked}" /></td>

							<td>
								<g:form>
				                    <g:hiddenField name="id" value="${competitorStationInstance?.id}" />
				                    <g:if test="${competitorStationInstance.isLocked==true}">
				                    	<span class="button"><g:actionSubmit class="unLock" action="unLock" value="${message(code: 'default.button.unLocked.label', default: 'unLocked')}" onclick="return confirm('${message(code: 'default.button.unLocked.confirm.message', default: 'Are you sure?')}');" /></span>
				                	</g:if>
				                	<g:if test="${competitorStationInstance.isLocked==false}">
				                    	<span class="button"><g:actionSubmit class="locked" action="locked" value="${message(code: 'default.button.locked.label', default: 'locked')}" onclick="return confirm('${message(code: 'default.button.locked.confirm.message', default: 'Are you sure?')}');" /></span>
				                	</g:if>
				                </g:form>
							</td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${competitorStationInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
